﻿using UnityEngine;
using UnityEngine.UI;

public class TKSelectCampPanel : BaseComponent
{
    private Button exitBtn;
    private Button shuCampBtn;
    private Button wuCampBtn;
    private Button weiCampBtn;
    private Button retractBtn;
    private GameObject stashPanelGo;
    private GameObject functionPanelGo;
    private GameObject calculatingGo;
    public override void Binding()
    {
        TKSelectCampPanelModel cm = (TKSelectCampPanelModel)GetComponentModel();
        exitBtn = transform.Find("ExitBtn").GetComponent<Button>();
        shuCampBtn = transform.Find("StashPanel/ShuCampBtn").GetComponent<Button>();
        wuCampBtn = transform.Find("StashPanel/WuCampBtn").GetComponent<Button>();
        weiCampBtn = transform.Find("StashPanel/WeiCampBtn").GetComponent<Button>();
        retractBtn = transform.Find("FunctionPanel/RetractBtn").GetComponent<Button>();
        stashPanelGo = transform.Find("StashPanel").gameObject;
        functionPanelGo = transform.Find("FunctionPanel").gameObject;
        calculatingGo = transform.Find("calculating").gameObject;
        exitBtn.onClick.AddListener(cm.OnClickExit);
        shuCampBtn.onClick.AddListener(cm.OnClickShuCampBtn);
        wuCampBtn.onClick.AddListener(cm.OnClickWuCampBtn);
        weiCampBtn.onClick.AddListener(cm.OnClickWeiCampBtn);

        retractBtn.onClick.AddListener(cm.OnClickRetract);
        BindData(cm.showStashPanel, (bool value) =>
        {
            stashPanelGo.SetActive(value);
        });
        BindData(cm.showFunction, (bool value) =>
        {
            functionPanelGo.SetActive(value);
        });
        BindData(cm.isCalculatingDM, (bool value) =>
        {
            calculatingGo.SetActive(value);
        });
    }

    public override void UnBinding()
    {

    }
}